<?php
declare(strict_types=1);
namespace cms\tencent\api_controller;

use cms\tencent\service\HandleService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\AutoController;
use TencentCloud\Common\Credential;
use TencentCloud\Common\Profile\ClientProfile;
use TencentCloud\Common\Profile\HttpProfile;
use TencentCloud\Faceid\V20180301\FaceidClient;
use TencentCloud\Faceid\V20180301\Models\DetectAuthRequest;

/**
 * Class TestController
 * @package cms\tencent\api_controller
 * @AutoController(prefix="api/tencent/test")
 */
class TestController extends CommonController
{
    /**
     * @Inject()
     * @var HandleService
     */
    protected HandleService $handleService;
    /**
     * 测试人脸核身
     */
    public function t001()
    {
        exit;
        $cred = new Credential('AKID99xWryqTr0vc4ILFwPcaJo69xWqvlMiq', 'vb3HGzTjkW3LOBj27xYu2waz95mEQN5Y');
        $httpProfile = new HttpProfile();
        $httpProfile->setEndpoint("faceid.tencentcloudapi.com");

        $clientProfile = new ClientProfile();
        $clientProfile->setHttpProfile($httpProfile);
        $client = new FaceidClient($cred, "", $clientProfile);

        $req = new DetectAuthRequest();

        $params = array(
            "RuleId" => "0"
        );
        $req->fromJsonString(json_encode($params));

        $resp = $client->DetectAuth($req);

        print_r($resp->toJsonString());
    }

    public function t002()
    {
        return '';
        $handle = $this->handleService->getDataById(1);
        $data = $this->handleService->action($handle);
    }
}